package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.domain.SubjectProductRelation;
import com.itheima.mapper.SubjectProductRelationMapper;
import com.itheima.service.ISubjectProductRelationService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 专题商品关系表 服务实现类
 * </p>
 *
 * @author fukeke
 * @since 2022-11-11
 */
@DubboService
public class SubjectProductRelationServiceImpl extends ServiceImpl<SubjectProductRelationMapper, SubjectProductRelation> implements ISubjectProductRelationService {
    @Autowired
    SubjectProductRelationMapper subjectProductRelationMapper;

    @Override
    public List<SubjectProductRelation> selectByProductId(Long productId) {
        LambdaQueryWrapper<SubjectProductRelation> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.eq(SubjectProductRelation::getProductId,productId);
        return subjectProductRelationMapper.selectList(queryWrapper);
    }

    @Override
    public void createCmsSubjectProductRelation(SubjectProductRelation cmsSubjectProductRelation) {
        subjectProductRelationMapper.insert(cmsSubjectProductRelation);
    }
}
